<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>客户预订下单</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	
	<link href="css/css-main.css" rel="stylesheet" type="text/css" />
	<script  type="text/javascript" src="<%=basePath%>js/datepicker/WdatePicker.js"></script>
<script type="text/javascript">
function submitForm(subType) {
	if (subType == 1) {
		// 查询
		document.getElementById("queryBookableForm").submit();
	} else {

		var selectNum = 0;
		var innerIndexs = document.getElementsByName("innerIndexs");

		for ( var i = 0; i < innerIndexs.length; i++) {
			if (innerIndexs[i].checked) {
				selectNum++;
			}
		}

		if (selectNum > 0) {

			if (subType == 2) {
				// 继续预订
				if(document.getElementById("oldRoomTypeId").value == document.getElementById("roomTypeId").options[window.document.getElementById("roomTypeId").selectedIndex].value)
				{
				   alert("请先选择其他房间类型再点击继续预订\n或在当前页面预订其他时段！");
				} 
				else
				{
				  document.getElementById("queryBookableForm").action = "<%=basePath%>cms/bookinfo/toContinueBooking.do";
				  document.getElementById("queryBookableForm").submit();
				}
				
			}
			
			if(subType == 3)
			{
				document.getElementById("queryBookableForm").action = "<%=basePath%>cms/bookinfo/toAddBookerInfo.do";
				document.getElementById("queryBookableForm").submit();
			}

		} else {
			if (subType == 3) {
				// 下一步

				if ("" == '<s:property value="#session.hasRecord"/>') {
					alert("你未选中任何时段记录！！");
				} else {
                      
					document.getElementById("queryBookableForm").action = "<%=basePath%>cms/bookinfo/toAddBookerInfo.do";
					document.getElementById("queryBookableForm").submit();
				}

			} else {
				alert("你未选中任何时段记录！！");
			}
		}
	}
}

     
	  
</script>

<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<sx:head />
  </head>
  
  <body>
    <form name ="queryBookableForm" id="queryBookableForm" action="cms/bookinfo/doQueryBookableRooms.do">
    <div class="main-con">
     <!--//导航位置层-->
        <input type="hidden" value='<s:property value="roomTypeId"/>' id="oldRoomTypeId"/>
      <div class="cont_right_cont">
        
        <fieldset>
          <legend>订房信息</legend>
          
          <div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
             
              <tr>
                <td><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="26%" align="right" height="40">房间类型：</td>
                      <td colspan="5">
                        
                        <select name="roomTypeId" id="roomTypeId" >
                        <option value="1" <s:if test="roomTypeId ==1">selected="selected"</s:if> >接待室</option>
                        <option value="2" <s:if test="roomTypeId ==2">selected="selected"</s:if>>会议室</option>
                        <option value="3" <s:if test="roomTypeId ==3">selected="selected"</s:if>>休闲区</option>
                        <option value="4" <s:if test="roomTypeId ==4">selected="selected"</s:if>>包厢</option>
                        <option value="5" <s:if test="roomTypeId ==5">selected="selected"</s:if>>多功能厅</option>
                        <option value="6" <s:if test="roomTypeId ==6">selected="selected"</s:if>>棋牌室</option>
                        <option value="7" <s:if test="roomTypeId ==7">selected="selected"</s:if>>茶包</option>
                        </select>
                      </td>
                     
                    </tr>
                  
                    <tr>
                      <td align="right" height="40">房间号：</td>
                      <td colspan="5">
                      <table border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td style="padding:0px"><input name="roomInfo.roomNum" type="text" class="data-searchtxt-runtime"id="roomNum" /></td>
                        </tr>
                      </table>
                      </td>
                    </tr>
                    <tr>
                      <td align="right" height="40">开始时间：</td>
                      <td width="11%"><input id="startTime" value='<s:property value="startTime"/>' name="startTime" type="text"
									class="data-searchtxt-time"
									onFocus="var endTime=$dp.$('endTime');WdatePicker({onpicked:function(){endTime.focus();},skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'%y-%M-%d %H:%m',maxDate:'#F{$dp.$D(\'endTime\',{m:-10})}'});" /></td>
                      <td width="11%" align="right">结束时间：</td>
                      <td width="21%"><input id="endTime" name="endTime" type="text" value='<s:property value="endTime"/>'
									class="data-searchtxt-time"
									onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime\',{m:10});}',maxDate:'2099-10-01'});" /></td>
                      <td width="22%"><input name="submit1" type="submit" class="data-searchbtn" id="button"  value="查 询" onclick="submitForm(1);"/></td>
                    </tr>
                  </table>
                 </td>
              </tr>
            </table>
            </div>
            
            </fieldset>
        
             <div align="center">
                                               请选择房间
              <sx:tabbedpanel id="roomTab">
                 <s:if test="results.size == 0">
                                                                              暂无可与订房间信息
                 </s:if>
                 <s:else>
                   <s:iterator value="results" status="s">
                     <s:if test="(roomTypeId == 6) ||  (roomTypeId == 7)">
                       <sx:div label="%{roomNum}"  href = 'cms/bookinfo/doQueryBookableTableNos.do?roomNum=%{roomNum}&startTime=%{startTime}&endTime=%{endTime}' refreshOnShow="true" >
                       </sx:div>
                    </s:if> 
                    <s:else>
                       
                        <sx:div label="%{roomNum}"  href ='cms/bookinfo/doQueryRoomPeriod.do?roomNum=%{roomNum}&startTime=%{startTime}&endTime=%{endTime}' refreshOnShow="true" >
                        </sx:div>  
                    </s:else>
                 </s:iterator>
                 </s:else>
              </sx:tabbedpanel>
          </div>
            <div align="center">
              <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                <tr>
                  <td width="50%" align="right"><input name="continueBookingBtn"  type="button" class="btn-Yes" id="continueBookingBtn" value="继续预定" onclick="submitForm(2);"
                   <s:if test="results.size == 0">
                      disabled="disabled"
                   </s:if>> </td>
                  <td width="50%" align="left"><input name="next" type="button" class="btn-Yes" id="next"  value="下一步" onclick="submitForm(3);"
                   <s:if test="results.size == 0">
                      disabled="disabled"
                   </s:if>></td>
                </tr>
              </table>
            </div>
    </div>
    </div>
    </form>
  </body>
</html>
